﻿using MediatR;
using W.Purchase.Domain;
using W.Purchase.Read.API.AppLication.Command.FinanceTypeCommand;
using W.Purchase.Repository.Interface;

namespace W.Purchase.Read.API.AppLication.CommandHandler.FinanceTypeCommandHandler
{
    public class FinanceTypeModelCommandHandler : IRequestHandler<FinanceTypeModelCommand, FinanceType>
    {
        private readonly IFinanceTypesRepository _ifinanceTypesRepository;
        public FinanceTypeModelCommandHandler(IFinanceTypesRepository ifinanceTypesRepository)
        {
            _ifinanceTypesRepository = ifinanceTypesRepository;
        }

        public async Task<FinanceType> Handle(FinanceTypeModelCommand request, CancellationToken cancellationToken)
        {
            var list = await _ifinanceTypesRepository.GetModelAsync(request.FinanceTypeId);
            return list;
        }
    }
}
